package com.zy.imagineCommunity.dao;

import com.zy.imagineCommunity.entity.User;
import com.zy.imagineCommunity.entity.UserText;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper //mybatis注解标识bean
public interface UserMapper {

    // 查询用户
    public User queryUserByUsernameAndPassword(String username, String password);

    // 根据用户昵称查询用户
    public User queryUserByUsername(String username);

    // 根据邮箱查询用户
    public User queryUserByEmail(String email);

    // 根据userId查询用户
    public User queryUserByUserId(int userId);

    // 增加用户
    public int addUser(User User);

    // 根据id修改用户
    public int updateUserByUserId(User user);

    //查询用户总数
    Integer queryUserTotalCount();

    //通过起始条数和每页个数查询每页的用户
    List<UserText> queryUserTextByBeginAndPageSize(int begin, int pageSize);

    //根据id删除用户id
    public int deleteUserById(int id);

    //根据用户名等查询用户总数
    int queryUserTotalCountByUserName(String username, String userType);

    //通过起始条数和每页个数以及用户姓名等查询每页的用户
    List<UserText> queryUserTextByBeginAndPageSizeAndUserName(int begin, int pageSize, String username, String userType);

    /**
     * 查找所有用户
     *
     * @return
     */
    List<User> queryUserList();

}
